namespace BXS.API.Exceptions
{
    /// <summary>
    /// 业务异常基类
    /// </summary>
    public class BusinessException : Exception
    {
        /// <summary>
        /// 错误码
        /// </summary>
        public int Code { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="message">错误消息</param>
        /// <param name="code">错误码</param>
        public BusinessException(string message, int code = 400) : base(message)
        {
            Code = code;
        }
    }

    /// <summary>
    /// 资源未找到异常
    /// </summary>
    public class NotFoundException : BusinessException
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="message">错误消息</param>
        public NotFoundException(string message) : base(message, 404)
        {
        }
    }

    /// <summary>
    /// 参数验证异常
    /// </summary>
    public class ValidationException : BusinessException
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="message">错误消息</param>
        public ValidationException(string message) : base(message, 400)
        {
        }
    }

    /// <summary>
    /// 未授权异常
    /// </summary>
    public class UnauthorizedException : BusinessException
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="message">错误消息</param>
        public UnauthorizedException(string message = "未授权访问") : base(message, 401)
        {
        }
    }

    /// <summary>
    /// 禁止访问异常
    /// </summary>
    public class ForbiddenException : BusinessException
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="message">错误消息</param>
        public ForbiddenException(string message = "禁止访问") : base(message, 403)
        {
        }
    }
} 